<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .move-leave-to {
      opacity: 0;
      transform: translateX(200px) scale(0);
    }

    .move-leave-active {
      transition: all 1s;
    }

    .move-enter {
      opacity: 0;
      transform: translateX(200px) scale(0);
    }

    .move-enter-active {
      transition: all 1s;
    }
  </style>
</head>

<body>
  <div id="app">
    <button @click="login=!login">切换</button>

    <!-- name="move" 相当于类名了 在style样式里 -->

    <transition name="move" mode="out-in">
      <h1 style="position:relative" v-if="login" key="1">登录页</h1>
      <!-- <h1 v-else key="2">注册页</h1> -->
    </transition>
  </div>


  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    new Vue({
      el: "#app",
      data: {
        login: true,
      },
      methods: {},
    })
  </script>
</body>

</html>